package com.gg.hc.service.impl;

import com.gg.common.mapper.MDesignProcedureMapper;
import com.gg.common.pojo.DFile;
import com.gg.common.pojo.MDesignProcedure;
import com.gg.hc.search.PageVo;
import com.gg.hc.service.MDesignProcedureService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class MDesignProcedureServiceimpl implements MDesignProcedureService {
    @Resource
    private MDesignProcedureMapper mDesignProcedureMapper;

    @Override
    public int updateCostPriceSumById(MDesignProcedure mDesignProcedure) {
        return mDesignProcedureMapper.updateCostPriceSumById(mDesignProcedure);
    }

    @Override
    public int updateMDesignProcedureSuppliesTag(String designId) {
        return mDesignProcedureMapper.updateMDesignProcedureSuppliesTag(designId);
    }

    @Override
    public int updateMDesignProcedureModuleCostPriceSum(MDesignProcedure mDesignProcedure) {
        return mDesignProcedureMapper.updateMDesignProcedureModuleCostPriceSum(mDesignProcedure);
    }

    @Override
    public PageVo<MDesignProcedure> QueryMDesignProcedureSuppliesAll(PageVo pageVo) {
        PageHelper.offsetPage(pageVo.getPageNumber(), pageVo.getPageSize());
        List<MDesignProcedure> dFiles = mDesignProcedureMapper.QueryMDesignProcedureSuppliesAll(pageVo);
        PageInfo pageInfo=new PageInfo(dFiles);
        PageVo<MDesignProcedure> pageVo1=new PageVo<MDesignProcedure>();
        pageVo1.setRows(pageInfo.getList());
        pageVo1.setTotal(pageInfo.getTotal());
        return pageVo1;
    }

    @Override
    public int UpdateMDesignProcedureSuppliesNoPass(MDesignProcedure mDesignProcedure) {
        return mDesignProcedureMapper.UpdateMDesignProcedureSuppliesNoPass(mDesignProcedure);
    }

    @Override
    public int UpdateMDesignProcedureSuppliesCheckTag(MDesignProcedure mDesignProcedure) {
        return mDesignProcedureMapper.UpdateMDesignProcedureSuppliesCheckTag(mDesignProcedure);
    }

    @Override
    public PageVo<MDesignProcedure> queryMDesignProcedureSupplies(PageVo pageVo) {
        PageHelper.offsetPage(pageVo.getPageNumber(), pageVo.getPageSize());
        List<MDesignProcedure> mDesignProcedures = mDesignProcedureMapper.queryMDesignProcedureSupplies(pageVo);
        PageInfo pageInfo=new PageInfo(mDesignProcedures);
        PageVo<MDesignProcedure> pageVo1=new PageVo<>();
        pageVo1.setRows(pageInfo.getList());
        pageVo1.setTotal(pageInfo.getTotal());
        return pageVo1;
    }

    @Override
    public int updateDesignModuleTagById(int id) {
        return mDesignProcedureMapper.updateDesignModuleTagById(id);
    }

    @Override
    public PageVo<MDesignProcedure> queryByDesignModuleTag(PageVo pageVo) {
        PageHelper.offsetPage(pageVo.getPageNumber(), pageVo.getPageSize());
        List<MDesignProcedure> mDesignProcedures = mDesignProcedureMapper.queryByDesignModuleTag(pageVo);
        PageInfo pageInfo=new PageInfo(mDesignProcedures);
        PageVo<MDesignProcedure> pageVo1=new PageVo<>();
        pageVo1.setRows(pageInfo.getList());
        pageVo1.setTotal(pageInfo.getTotal());
        return pageVo1;
    }

    @Override
    public int UpdateCheckTag(MDesignProcedure mDesignProcedure) {
        return mDesignProcedureMapper.UpdateCheckTag(mDesignProcedure);
    }

    @Override
    public void UpdateMDesignProcedureNoPass(MDesignProcedure mDesignProcedure) {
        mDesignProcedureMapper.UpdateMDesignProcedureNoPass(mDesignProcedure);
    }

    @Override
    public void UpdateMDesignProcedureCheckTag(MDesignProcedure mDesignProcedure) {
        mDesignProcedureMapper.UpdateMDesignProcedureCheckTag(mDesignProcedure);
    }

    @Override
    public void AddMDesignProcedure(MDesignProcedure mDesignProcedure) {
        mDesignProcedureMapper.AddMDesignProcedure(mDesignProcedure);
    }

    @Override
    public PageVo<MDesignProcedure> queryMDesignProcedureAll(PageVo pageVo) {
        PageHelper.offsetPage(pageVo.getPageNumber(), pageVo.getPageSize());
        List<MDesignProcedure> mDesignProcedures = mDesignProcedureMapper.queryMDesignProcedureAll(pageVo);
        PageInfo pageInfo=new PageInfo(mDesignProcedures);
        PageVo<MDesignProcedure> pageVo1=new PageVo<>();
        pageVo1.setRows(pageInfo.getList());
        pageVo1.setTotal(pageInfo.getTotal());
        return pageVo1;
    }

    @Override
    public PageVo<MDesignProcedure> QueryMDesignProcedureAll(PageVo pageVo) {
        PageHelper.offsetPage(pageVo.getPageNumber(), pageVo.getPageSize());
        List<MDesignProcedure> mDesignProcedures = mDesignProcedureMapper.QueryMDesignProcedureAll(pageVo);
        PageInfo pageInfo=new PageInfo(mDesignProcedures);
        PageVo<MDesignProcedure> pageVo1=new PageVo<>();
        pageVo1.setRows(pageInfo.getList());
        pageVo1.setTotal(pageInfo.getTotal());
        return pageVo1;
    }
}
